﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Manage_User.aspx.cs" Inherits="Com.CMS263.Web.manage.Manage_User" %>

<%@ Import Namespace="Com.CMS263.PO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../style/main.css" rel="stylesheet" type="text/css" />
    <link href="../common/validator.css" rel="stylesheet" type="text/css" /> 
    <script src="../../js/jquery-1.4.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        function edits(id) {
            window.location.href = "ManageUser_edit.aspx?id=" + id;
        }       
        function lookorder(orderid) {
            window.location.href = "ManagePersonOrder.aspx?orderid=" + orderid;
        }
        function ShowState(id,ImageName) {
            $.post("User_action.aspx?op=Valid", { id: id }, function(data) {
                $("#" + ImageName + id).attr("src", "../images/" + data + ".png");               
            })
        }
        function del(id, obj) {
            if (confirm('这是一个不可逆的操作，真的要删除此条记录')) {
                $.post("User_action.aspx?op=delMessage", { id: id}, function(data) {
                    if (data == "ok") {
                        alert('删除成功');
                        $(obj.parentNode.parentNode).remove();
                    }
                })
            }
        }
        $(function() {
            $("#tab tr").mouseover(function() {
                $("#tab tr").attr("className", "")
                $(this).attr("className", "asd01")
            })
        })
    </script>

</head>
<body>
    <form id="form1" runat="server" enctype="multipart/form-data" method="post">
    <div id="userlist">
        <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
            <tr>
                <td height="23" class="table_2">
                    用户管理
                </td>
            </tr>
            <tr>
                <td>
                    用户管理&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="text" id="username" name="key" value='<%=Request["key"] %>' />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="submit" id="submit" value="搜索" style="width: 50px" />
                </td>
            </tr>
            <tr>
                <td class="tdside" align="center">
                    <table width="100%" id="tab" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
                        <tr>
                            <td>
                                序号
                            </td>
                            <td>
                                邮箱
                            </td>
                            <td>
                                用户名
                            </td>
                            <td>
                                注册日期
                            </td>
                            <td>
                                手机号码
                            </td>
                            <td>
                                地址
                            </td>
                            <td>
                                账户余额
                            </td>                          
                            <td>
                                状态
                            </td>
                                <td>
                                是否审核
                            </td>
                            <td colspan="4">
                                操作
                            </td>
                        </tr>
                        <% if (guestlist.Count > 0)
                           {
                               for (int i = 0; i < guestlist.Count; i++)
                               {
                        %>
                        <tr>
                            <td>
                                <%=guestlist[i].Id%>
                            </td>
                            <td>
                                <%=guestlist[i].UserEmail%>
                            </td>
                            <td>
                                <%=guestlist[i].UserName%>
                            </td>
                            <td>
                                <%=guestlist[i].AddDate%>
                            </td>
                            <td>
                                <%=(guestlist[i].MobilePhone!="-1"?guestlist[i].MobilePhone:"未填")%>
                            </td>
                             <td>
                                <%=guestlist[i].Address==null?"未填":guestlist[i].Address%>
                            </td>      
                            <td>
                                <%=guestlist[i].Balance%>
                            </td>                           
                            <td>
                                <%=(guestlist[i].State == 1 ? "是" : "否")%>
                            </td>
                              <td>   
                               <a href="####" onclick="ShowState(<%=guestlist[i].Id%>,'ImagesValid');"> <img style="border:0px;"   id="ImagesValid<%=guestlist[i].Id%>"  alt="" src="../images/<%=Com.CMS263.Util.StringUtil.GetBoolToString(guestlist[i].IsChecked,"yes","no")%>.png" /></a>
                            </td>
                            <td>
                            <a href="GetPass.aspx" style="cursor:pointer;">找回密码</a>
                            </td>
                            <td>
                                <input type="button" value="修改" style="width: 50px" id="edit" onclick="return edits(<%=guestlist[i].Id%>)" />
                            </td>
                            <td><input type="button" value="查看订单" style=" width:80px" id="order" onclick="return lookorder(<%=guestlist[i].Id%>)" /></td>
                            <td>
                                <input type="submit" value="删除" id="delete" style="width: 50px" onclick="del(<%=guestlist[i].Id%>,this);" />
                            </td>                           
                        </tr>
                        <%}

                         }
                           else
                           {
                        %>
                        <tr>
                            <td colspan="10">
                                数据库没有数据!
                            </td>
                        </tr>
                        <%
                            } %>

                    </table>
                </td>
            </tr>
           <tr> <td class="tdside" align="right">
<%=GetPager() %></td></tr>
        </table>
    </div>
    <div  id="search" style=" display:none">
        <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
            <tr>
                <td height="23" class="table_2">
                    搜索用户结果
                </td>
            </tr>
            <tr>
                <td class="tdside" align="center">
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_1">
                        <tr>
                            <td>
                                序号
                            </td>
                            <td>
                                邮箱
                            </td>
                            <td>
                                用户名
                            </td>
                            <td>
                                注册日期
                            </td>
                            <td>
                                手机号码
                            </td>
                            <td>
                                地址
                            </td>
                            <td>
                                账户余额
                            </td>                          
                            <td>
                                状态
                            </td>
                                <td>
                                是否审核
                            </td>
                            <td colspan="4">
                                操作
                            </td>
                        </tr>
                        <%  if (Searchlist.Count > 0)
                            {
                                for (int i = 0; i < Searchlist.Count; i++)
                                {
                        %>                 
                         <tr>
                            <td>
                                <%=guestlist[i].Id%>
                            </td>
                            <td>
                                <%=Searchlist[i].UserEmail%>
                            </td>
                            <td>
                                <%=Searchlist[i].UserName%>
                            </td>
                            <td>
                                <%=Searchlist[i].AddDate%>
                            </td>
                            <td>
                                <%=(Searchlist[i].MobilePhone!="-1"?Searchlist[i].MobilePhone:"未填")%>
                            </td>
                             <td>
                                <%=Searchlist[i].Address==null?"未填":Searchlist[i].Address%>
                            </td>      
                            <td>
                                <%=Searchlist[i].Balance%>
                            </td>                           
                            <td>
                                <%=(Searchlist[i].State == 1 ? "是" : "否")%>
                            </td>
                              <td>   
                                <img   id="Img1"  alt="" src="../images/<%=Com.CMS263.Util.StringUtil.GetBoolToString(Searchlist[i].IsChecked,"yes","no")%>.png" />
                            </td>
                            <td>
                              <a href="GetPass.aspx" style="cursor:pointer;">找回密码</a>
                            </td>
                            <td>
                                <input type="button" value="修改" style="width: 50px" id="Button3" onclick="return edits(<%=Searchlist[i].Id%>)" />
                            </td>
                            <td><input type="button" value="查看订单" style=" width:80px" id="Button4" onclick="return lookorder(<%=Searchlist[i].Id%>)" /></td>
                            <td>
                                <input type="submit" value="删除" id="Submit1" style="width: 50px" onclick="del(<%=Searchlist[i].Id%>,this);" />
                            </td>
                            <td>
                            <a href="####" onclick="ShowState(<%=Searchlist[i].Id%>,'ShowValidSpan','ImagesValid','审核','取消审核');"><span id="Span1"><%=Com.CMS263.Util.StringUtil.GetBoolToString(Searchlist[i].IsChecked, "<font color=\"red\">取消审核</font>", "<font color=\"#999\">审核</font>")%></span></a>
                            </td>
                        </tr>
                        <%}

                         }
                       else
                {
                        %>
                       <tr>
                            <td colspan="11">
                                搜索无结果
                            </td>
                        </tr>
                        <%
                         } %>
                    </table>
                </td>
            </tr>
                       <tr> <td class="tdside" align="right">
<%=GetPager()%></td></tr>
        </table>
    </div>
    </form>
</body>
</html>
